home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / a_to_d / delftips / ti2805.asc < prev    next >
Encoding:
Text File  |  1996-09-15  |  964 b   |  61 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Delphi                                 NUMBER  :  2805
  8.   VERSION  :  All
  9.        OS  :  Windows
  10.      DATE  :  May 31, 1995                             PAGE  :  1/1
  11.  
  12.     TITLE  :  Getting the Line number in a memo Field
  13.  
  14.  
  15.  
  16.  
  17. How do you figure out what line number you are currently 
  18. on with a TMemo control?
  19.  
  20. The trick is to use the em_LineFromChar message.  Try this:
  21.  
  22. procedure TMyForm.BitBtn1Click(Sender: TObject);
  23. var
  24.   iLine : Integer ;
  25. begin
  26.    iLine := Memo1.Perform(em_LineFromChar, $FFFF, 0);
  27.    { Note: First line is zero }
  28.    messageDlg('Line Number: ' + IntToStr(iLine), mtInformation, 
  29.               [mbOK], 0 ) ;
  30. end;
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. DISCLAIMER: You have the right to use this technical information
  58. subject to the terms of the No-Nonsense License Statement that
  59. you received with the Borland product to which this information
  60. pertains.
  61.